# -*- coding:utf-8 -*-
# File Name:str_util.py
# Author:jing
# Date:2018/12/18
import random

__author__ = 'jing'


def get_random_string(n):
    string_range = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-1234567890'
    return _get_random(string_range, n)


def get_random_kube_name(n):
    return _get_random('abcdefghijklmnopqrstuvwxyz1234567890-', n)


def _get_random(string_range, n):
    chars = []
    for i in range(n):
        chars.append(string_range[random.randint(0, len(string_range) - 1)])
    return ''.join(chars)
